package com.jiantong.work.impl.service;

import com.google.common.base.Throwables;
import com.jiantong.work.impl.dao.ReportHandleResumeDao;
import com.jiantong.work.model.ReportHandleResume;
import com.jiantong.work.service.ReportHandleResumeWriteService;
import io.terminus.boot.rpc.common.annotation.RpcProvider;
import io.terminus.common.model.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by niufei on 2017/3/20.
 *
 */
@Slf4j
@Service
@RpcProvider
public class ReportHandleResumeWriteServiceImpl implements ReportHandleResumeWriteService{

    private final ReportHandleResumeDao reportHandleResumeDao;

    @Autowired
    public ReportHandleResumeWriteServiceImpl(ReportHandleResumeDao reportHandleResumeDao) {
        this.reportHandleResumeDao = reportHandleResumeDao;
    }

    @Override
    public Response<Boolean> create(ReportHandleResume reportHandleResume) {
        try{
            return Response.ok(reportHandleResumeDao.create(reportHandleResume));
        }catch (Exception e){
            log.error("failed to create reportHandleResume error :{}", Throwables.getStackTraceAsString(e));
            return Response.fail("reportHandleResume.create.failed");
        }
    }
}
